package com.test.bat;

import java.util.concurrent.TimeUnit;

public class WorkThread implements Runnable {

	private volatile boolean shutdown = false;
	private volatile boolean running = false;

	@Override
	public void run() {
		while (!shutdown) {
			running = true;
			System.out.println("I'm running...");
			try {
				TimeUnit.SECONDS.sleep(1);
			} catch (InterruptedException e) {
			}
		}
		running = false;
	}

	public void shutdown() {
		shutdown = true;
	}

	public void start() {
		new Thread(this).start();
	}

	public boolean isAlive() {
		return running;
	}

}
